{include file="common/header-top" /}


<style>
    .thirdStep-cell-li .van-cell__title{
        max-width: 26%;
    }
</style>


<div id='app' v-cloak>

    <van-nav-bar
            title="信息中心"
            left-arrow
            @click-left="goBack"
            left-text="返回"
    >
        <van-cell
            title="认证成商家"
            icon="/__FRONT__/images/icon/user-setting-qy-n.png"
            slot="right"
            url="/index/Usercenter/approveCompany"
            v-if="showApproveBus"
        >
        </van-cell>
        <van-cell
            title="认证成个人"
            icon="/__FRONT__/images/icon/user-setting-qy-n.png"
            slot="right"
            url="/index/Usercenter/approvePerson"
            v-if="showApproveSinger"
        >
        </van-cell>
    </van-nav-bar>



    <!--显示认证按钮-->
    <van-row v-show="showEditDiv" style="padding-top: 20px;">
        <h3 style="text-align: center;">您还未认证!</h3>
        <van-grid clickable :column-num="2" icon-size="65px" style="padding-top: 50px;">
            <van-grid-item
                    icon="/__FRONT__/images/icon/user-setting-person-n.png"
                    text="个人认证"
                    url="/index/Usercenter/approvePerson"
            ></van-grid-item>
            <van-grid-item
                    icon="/__FRONT__/images/icon/user-setting-qy-n.png"
                    text="企业认证"
                    url="/index/Usercenter/approveCompany"
            ></van-grid-item>
        </van-grid>
    </van-row>
    <!--显示认证按钮-->


    <!--显示认证中-->
    <van-row v-show="userInfo.status == 1">
        <van-grid clickable :column-num="1" icon-size="55px" style="padding-top: 10px;">
            <van-grid-item
                    icon="/__FRONT__/images/icon/user-setting-geren-rz.png"
                    :text="showStatusText"
                    v-if="userInfo.type == 1"
            ></van-grid-item>
            <van-grid-item
                    icon="/__FRONT__/images/icon/user-setting-qiye-rz.png"
                    :text="showStatusText"
                    url="/index/Usercenter/approveCompany"
                    v-if="userInfo.type == 2"
            ></van-grid-item>
        </van-grid>
    </van-row>
    <!--显示认证中-->




    <!--认证失败-->
    <van-notice-bar :scrollable="false" wrapable v-if="approveFalse" style="padding: 8px 1px;">
        <van-row>
            <van-col span="18">
                <strong style="font-size: 16px;" class="van-ellipsis">您的信息未认证通过！</strong><br/>
                <span class="van-multi-ellipsis--l2" style="font-size: small;">
                    未通过原因：{{userInfo.replay}}
                </span>
            </van-col>
            <van-col span="6">
                <van-button round type="danger" :url="getAgainApproveUrl">重新认证</van-button>
            </van-col>
        </van-row>
    </van-notice-bar>
    <!--认证失败-->




    <!--基本信息-->
    <van-row v-if="userInfo.type">
        <van-cell title="基本信息" icon="/__FRONT__/images/icon/user-setting-base.png" >
        </van-cell>
        <van-cell title="认证姓名"
                  class="thirdStep-cell-li"
                  icon="/__FRONT__/images/icon/user-setting-name.png"
                  :value="showTrueName">
        </van-cell>
        <van-cell title="联系方式"
                  class="thirdStep-cell-li"
                  icon="/__FRONT__/images/icon/user-setting-mobile.png"
                  :value="showMobile">
        </van-cell>
        <van-cell title="认证类型"
                  class="thirdStep-cell-li"
                  icon="/__FRONT__/images/icon/user-setting-renzheng.png"
                  :value="showAuthText">
        </van-cell>
        <van-cell title="所属地区"
                  class="thirdStep-cell-li"
                  icon="/__FRONT__/images/icon/publish-job-area.png"
                  :value="userInfo.areainfo">
        </van-cell>
        <van-divider :style="{borderColor: '#32a14a', padding: '0px', margin: '0px'}"></van-divider>
    </van-row>
    <!--基本信息-->


    <!-- 个人认证信息 -->
    <van-row v-if="showPersonal">
        <van-cell title="个人认证信息" icon="/__FRONT__/images/icon/user-setting-personal.png" ></van-cell>
        <!--身份信息-->
        <van-col span="24">
            <van-cell title="性别"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/publish-job-sex.png"
                      :value="showGender">
            </van-cell>
            <!-- <van-cell title="身份证"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-idcard.png"
                      :value="showIdCard">
            </van-cell> -->
            <van-cell title="职业"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-profession.png"
                      :value="showProfession">
            </van-cell>
        </van-col>

        <!--教育信息-->
        <van-col span="24">
            <van-divider :style="{borderColor: '#32a14a', padding: '0px', margin: '5px'}"></van-divider>
            <van-cell title="教育信息" icon="/__FRONT__/images/icon/user-setting-edu.png" ></van-cell>

            <van-cell title="学历"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-xueli.png"
                      :value="showEducation">
            </van-cell>

            <van-cell title="学校"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-school-g.png"
                      :value="showSchool">
            </van-cell>

            <van-cell title="专业"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-major.png"
                      :value="showMajor">
            </van-cell>

        </van-col>


        <!--其他-->
        <van-col span="24">
            <van-divider :style="{borderColor: '#32a14a', padding: '0px', margin: '5px'}"></van-divider>
            <van-cell title="其他信息" icon="/__FRONT__/images/icon/user-setting-other.png" > </van-cell>
            <!--
            <van-cell title="邮箱"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-email.png"
                      :value="showEmail">
            </van-cell>
            -->
            <van-cell title="微信号"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-wechat.png"
                      :value="showWechat">
            </van-cell>
            <van-cell title="支付宝号"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/alipay-icon.png"
                      :value="showAlipay">
            </van-cell>
        </van-col>
    </van-row>
    <!-- 个人认证信息 -->




    <!-- 认证成企业信息 -->
    <van-row v-if="showBusiness">
        <van-cell title="商家认证信息" icon="/__FRONT__/images/icon/user-setting-business.png" >
        </van-cell>
        <!--身份信息-->
        <van-col span="24">
            <van-cell title="公司名称"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-company-name.png"
                      :value="userExtendBus.company_name">
            </van-cell>
            <van-cell title="法人证件"
                class="thirdStep-cell-li"
                icon="/__FRONT__/images/icon/user-setting-idcard.png"
                :value="showIdCard"
            >
            </van-cell>
            <van-cell title="营业执照编号"
                      class="thirdStep-cell-li"
                      icon="/__FRONT__/images/icon/user-setting-company-num.png"
                      :value="userExtendBus.company_license">
            </van-cell>
        </van-col>


        <!--教育信息-->
        <van-col span="24">
            <van-divider :style="{borderColor: '#32a14a', padding: '0px', margin: '5px'}"></van-divider>
            <van-cell title="营业执照" icon="/__FRONT__/images/icon/user-setting-company-num.png" ></van-cell>

            <van-col span="24">
                <van-image
                    fit="contain"
                    lazy-load
                    :src="userExtendBus.company_license_img"
                >
                    <template v-slot:loading>
                        <van-loading type="spinner"></van-loading>
                    </template>
                </van-image>

            </van-col>

            <van-divider :style="{borderColor: '#32a14a', padding: '0px', margin: '5px'}"></van-divider>
            <van-cell title="商家简介" icon="/__FRONT__/images/icon/user-setting-company-r.png" ></van-cell>
            <van-col span="24">
                <article>
                    {{userExtendBus.company_intro}}
                </article>
            </van-col>

        </van-col>

    </van-row>
    <!-- 认证成企业信息 -->






    {include file="common/foot-bar" /}

</div>









<script>

    Vue.use(vant.Lazyload);

    var vm = new Vue({
        el: '#app',
        data() {
            return {
                currentRate: 0,
                active:3,
                userCenterIcon: {
                    normal: '/__FRONT__/images/icon/usercenter-n.png',
                    active: '/__FRONT__/images/icon/usercenter-a.png'
                },
                erShouIcon: {
                    normal: '/__FRONT__/images/icon/ershou-n.png',
                    active: '/__FRONT__/images/icon/ershou-a.png'
                },


                isShowUserInfo: false,
                userInfo:{},
                userExtend:{},
                userExtendBus:{},
            };
        },

        created(){
            axiosRequest.get('/api/user/userInfo', {params:{userExtend:1,userExtendBus:1}}).then(function (response) {
                if (response.code == 200) {
                    vm.$data.isShowUserInfo = response.data.isShowUserInfo;
                    vm.$data.userInfo = response.data.userInfo;
                    vm.$data.userExtend = response.data.userInfo.extend;
                    vm.$data.userExtendBus = response.data.userInfo.extendBus;
                } else {
                    vant.Toast(response.msg);
                }
            });

        },

        computed:{
            showTrueName(){
                return (this.userExtend.true_name ? this.userExtend.true_name : '未认证') + '|' + '(' + this.userInfo.wechat_nickname + ')';
            },
            showMobile(){
                return this.userExtend.mobile ? this.userExtend.showMobile : '暂无';
            },
            showIdCard(){
                return this.userExtend.id_card ? this.userExtend.showIdCard : '暂无';
            },
            showGender(){
                return (this.userExtend.true_sex == 0) ? '保密' : this.userExtend.showGender;
            },
            showProfession(){
                return (this.userExtend.profession == 0) ? '暂无' : this.userExtend.showProfession;
            },
            showEmail(){
                return this.userInfo.email_bind ? this.userInfo.email : '暂无';
            },
            showAlipay(){
                return this.userExtend.alipay_num ? this.userExtend.alipay_num : '暂无';
            },
            showWechat(){
                return this.userExtend.wechat_id_card ? this.userExtend.wechat_id_card : '暂无';
            },
            showEducation(){
                return this.userExtend.profession ? this.userExtend.showEducation : '暂无';
            },
            showSchool(){
                return this.userExtend.education_school ? this.userExtend.showSchool : '暂无';
            },
            showMajor(){
                return this.userExtend.education_major ? this.userExtend.showMajor : '暂无';
            },
            showStatusText(){
                if (this.userInfo.status == 1) {
                    return '认证审核中...';
                }
                if (this.userInfo.status == 2) {
                    return '认证成功...';
                }
                if (this.userInfo.status == 3) {
                    return '认证未通过...';
                }
                return '';
            },
            showAuthText(){
                if (this.userInfo.type == 1) {
                    return '个人';
                }
                if (this.userInfo.type == 2) {
                    return '商家';
                }
                return '未认证';
            },

            showEditDiv(){
                if (this.userInfo.type == 0 && this.userInfo.status == 0) {
                    return true;
                }
                return false;
            },

            showPersonal(){
                if (this.userInfo.type == 1) {
                    return true;
                }
                return false;
            },
            showBusiness(){
                if (this.userInfo.type == 2) {
                    return true;
                }
                return false;
            },

            //认证成个人后，显示认证成商家按钮
            showApproveBus(){
                if (this.userInfo.type == 1 && this.userInfo.status == 2) {
                    return true;
                }
                return false;
            },
            //认证成商家后，显示认证成个人按钮
            showApproveSinger(){
                if (this.userInfo.type == 2 && this.userInfo.status == 2) {
                    return true;
                }
                return false;
            },
            //认证失败显示
            approveFalse(){
                if (this.userInfo.status == 3) {
                    return true;
                }
                return false;
            },
            //获取重新认证链接
            getAgainApproveUrl(){
                if (this.userInfo.type == 1) {
                    return '/index/Usercenter/approvePerson';
                }
                if (this.userInfo.type == 2) {
                    return '/index/Usercenter/approveCompany';
                }
            },
        },

        methods:{

            //返回上一页
            goBack(){
                history.back();
            },
        }
    });




</script>







{include file="common/foot-bottom" /}
